The technology described herein relates to a method of and apparatus for encoding and decoding data, and in particular to such a method and apparatus for use to compress and decompress texture data in computer graphics systems.
It is common in computer graphics systems to generate colours for sampling positions in the image to be displayed by applying so-called textures or texture data to the surfaces to be drawn. For example, surface detail on objects may be generated by applying a predefined “texture” to a set of polygons representing the object, to give the rendered image of the object the appearance of the “texture”. Such textures are typically applied by storing an array of texture elements or “texels”, each representing given texture data (such as colour, luminance, and/or light/shadow, etc. values), and then mapping the texels onto the corresponding elements, such as (and, indeed, typically) a set of sampling positions, for the image to be displayed. The stored arrays of texture elements (data) are typically referred to as “texture maps”.
Such arrangements can provide high image quality, but have a number of drawbacks. In particular, the storage of the texture data and accessing it in use can place, e.g., high storage and bandwidth requirements on a graphics processing device (or conversely lead to a loss in performance where such requirements are not met). This is particularly significant for mobile and handheld devices that perform graphics processing, as such devices are inherently limited in their, e.g., storage, bandwidth and power resources and capabilities.
It is known therefore to try to encode such texture data in a “compressed” form so as to try to reduce, e.g., the storage and bandwidth burden that may be imposed on a device.
One known such texture data compression technique determines a set or palette of colours to be used for, e.g., a given texture map, and then stores for each texture element (texel) in the texture map an index into the set or palette of colours, indicating the colour to be used for that texel. This has the advantage that only an index, rather than a full (e.g.) colour value needs to be stored for each texel. This helps to reduce, e.g., the texture data storage requirements, but still has some drawbacks, such as in terms of reduced image quality and the necessary data processing.
Another known texture compression technique is to use so-called block truncation coding (BTC). In this technique the overall texture array (texture map) is subdivided into smaller blocks, e.g. of 4×4 texels, and a number (typically two) of base or primary colour values are determined for each such block, with each texel in the block being set to one of the base colour values. This again saves on the data that has to be stored and accessed, but at a cost of lower image quality.
U.S. Pat. No. 5,047,853 describes an improved block truncation coding technique. In this technique, two base colours are again stored for each texel block, but two additional colours to be used for the block are also derived from those two base colours (e.g. by linearly blending those colours). In this way, four colours are provided as a “palette” for the texel block, but only two colour values need to be stored for the block. Each texel in the block is then encoded using two bits, to indicate which of the four block “colours” should be used for the texel. This system provides improved image quality over basic block truncation coding, but requires more data per block.
It is also known in some texture compression schemes, such as BC6 and BC7, to divide the set of texture data elements that is encoded in a given texture data block into plural “sub-sets” or “partitions” of texture data elements.
In these arrangements, each texture data element partition for the texture data block (i.e. sub-set of the texture data elements that the texture data block encodes) may then, e.g., be reproduced independently of the other partitions of the block. This can help to enhance the reproduced image quality, e.g. where the block to be encoded includes distinct colour partitions.
In these arrangements, the encoding scheme typically uses a set of predetermined allowed partitioning patterns, e.g., that are specified for particular block sizes. The decoder then stores a set of look-up tables that indicate the relationship between a texture data element's position and the partition it belongs to for each respective partitioning pattern. However, this can lead to significant storage requirements for the decoder, particularly if it is desired to use large numbers of partitioning patterns (or conversely, the number of available partitioning patterns has to be limited to reduce the storage burden on the decoder).
The Applicants believe therefore that there remains scope for improved data encoding and compression techniques when using partitioning, particularly for use for texture data for graphics processing.